package com.eastfair.home.enumeration;

import com.eastfair.annotation.base.BaseEnum;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * <p>
 * 实体注释中生成的类型枚举
 * 展台验收记录
 * </p>
 *
 * @author linan
 * @date 2022-11-29
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "BoothAcceptanceRecordAcceptanceStatusEnum", description = "验收状态  #{UN_ACCEPTANCE:未验收;REQUESTED:已申请;PASS:验收通过;NOT_PASS:验收失败-枚举")
public enum BoothAcceptanceRecordAcceptanceStatusEnum implements BaseEnum {

    /**
     * UN_ACCEPTANCE="未验收"
     */
    UN_ACCEPTANCE("未验收"),
    /**
     * REQUESTED="已申请"
     */
    REQUESTED("已申请"),
    /**
     * PASS="验收通过"
     */
    PASS("验收通过"),
    /**
     * NOT_PASS="验收失败"
     */
    NOT_PASS("验收失败"),
    ;

    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     */
    public static BoothAcceptanceRecordAcceptanceStatusEnum match(String val, BoothAcceptanceRecordAcceptanceStatusEnum def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static BoothAcceptanceRecordAcceptanceStatusEnum get(String val) {
        return match(val, null);
    }

    public boolean eq(BoothAcceptanceRecordAcceptanceStatusEnum val) {
        return val != null && eq(val.name());
    }

    @Override
    @ApiModelProperty(value = "编码", allowableValues = "UN_ACCEPTANCE,REQUESTED,PASS,NOT_PASS", example = "UN_ACCEPTANCE")
    public String getCode() {
        return this.name();
    }

}
